package com.qfedu.fmmall.stock.service.impl;

import com.qfedu.fmmall.stock.dao.ShoppingCartDao;
import com.qfedu.fmmall.stock.service.StockCartService;
import com.qfedu.fmmall.vo.ShoppingCartVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author : yanBin
 * @date :2022/1/25 11:52
 * 查询库存
 */
@Service
public class StockCartServiceImpl implements StockCartService {
    @Autowired
    private ShoppingCartDao shoppingCartDao;

    @Override
    public List<ShoppingCartVO> selectShoppingCartByCids(String cids) {
        //查询购物车记录
        String[] split = cids.split(",");
        List<Integer> list = new ArrayList<>();
        for (String s : split) {
            list.add(Integer.valueOf(s));
        }
        List<ShoppingCartVO> shoppingCartVOList = shoppingCartDao.selectShoppingCartByCids(list);
        return shoppingCartVOList;
    }
}
